<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>行程预览</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">

  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  <style>
    .layui-form-item .layui-input-inline{
      width: 500px;
    }
  </style>
</head>
<body>
<div class="layui-tab layui-tab-card" style="box-shadow: none">
  <ul class="layui-tab-title">
    <li {if !empty($typeid)&&$typeid=='1'} class="layui-this" {/if}>机场</li>
    <li {if !empty($typeid)&&$typeid=='2'} class="layui-this" {/if}>城市</li>
    <li {if empty($typeid)||$typeid=='3'} class="layui-this" {/if}>POI</li>
    <li {if !empty($typeid)&&$typeid=='5'} class="layui-this" {/if}>跟团游</li>
    <li {if !empty($typeid)&&$typeid=='4'} class="layui-this" {/if}>其他</li>
  </ul>
  <div class="layui-tab-content">
    <div class="layui-tab-item {if !empty($typeid)&&$typeid=='1'}layui-show{/if}">
      <form class="layui-form" id="airport">
        {notempty name="$groupid"}
        <input type="hidden" name="groupid" value="{$groupid}">
        {/notempty}

        {notempty name="$menu.id"}
        <input type="hidden" name="id" value="{$menu.id}">
        {/notempty}

        <input type="hidden" name="typeid" value="1">

        <div class="layui-form-item">
          <label class="layui-form-label">所属城市</label>
          <div class="layui-input-inline">
            <select name="cityname"  lay-filter="airportcity" lay-verify="required" lay-search>
              {volist name="city" id="vo"}
              <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
              {/volist}
            </select>
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">机场</label>
          <div class="layui-input-inline">
            <select name="poiname" lay-verify="required" id="airportpoi"  lay-search>
              {volist name="airportpoi" id="vo"}
              <option value="{$vo.name}" {if $menu.poiname==$vo.name} selected{/if}>{$vo.name}</option>
              {/volist}
            </select>

          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">时间</label>
          <div class="layui-input-inline">
            <input name="time" value="{$menu.time}"  id="airporttime"  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
          </div>
        </div>


        <div class="layui-form-item">
          <label class="layui-form-label">内容</label>
          <div class="layui-input-inline">
            <textarea placeholder="请输入内容" class="layui-textarea" name="content">{$menu.content}</textarea>
          </div>
        </div>



        <div class="layui-form-item">
          <label class="layui-form-label">地图起始点</label>
          <div class="layui-input-inline">
            <input type="radio" name="mapmark" value="起点" title="起点" {if $menu.mapmark=='起点'}checked=""{/if} >
            <input type="radio" name="mapmark" value="途经" title="途经" {if $menu.mapmark=='途经'}checked=""{/if}>
            <input type="radio" name="mapmark" value="终点" title="终点" {if $menu.mapmark=='终点'}checked=""{/if}>
          </div>
        </div>




        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="airport">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
          </div>
        </div>

      </form>
    </div>
    <div class="layui-tab-item {if !empty($typeid)&&$typeid=='2'}layui-show{/if}">
      <form class="layui-form" id="citys">
        <!--<div class="layui-form-item">-->
          <!--<label class="layui-form-label">类别</label>-->
          <!--<div class="layui-input-inline" style="position: relative">-->
            <!--<input type="radio" name="sex" value="大城市" title="大城市" checked="">-->
            <!--<input type="radio" name="sex" value="旅游城市" title="旅游城市">-->
          <!--</div>-->
        <!--</div>-->
        <input type="hidden" name="typeid" value="2">

        {notempty name="$groupid"}
        <input type="hidden" name="groupid" value="{$groupid}">
        {/notempty}

        {notempty name="$menu.id"}
        <input type="hidden" name="id" value="{$menu.id}">
        {/notempty}

        <div class="layui-form-item">
          <label class="layui-form-label">城市</label>
          <div class="layui-input-inline">
            <select name="cityname" lay-verify="required" lay-search>
              {volist name="city" id="vo"}
              <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
              {/volist}
            </select>
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">时间</label>
          <div class="layui-input-inline">
            <input name="time" value="{$menu.time}"  id="citystime"   placeholder="请输入" autocomplete="off" class="layui-input" type="text">
          </div>
        </div>


        <div class="layui-form-item">
          <label class="layui-form-label">内容</label>
          <div class="layui-input-inline">
            <textarea placeholder="请输入内容" class="layui-textarea" name="content">{$menu.content}</textarea>
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">地图起始点</label>
          <div class="layui-input-inline">
            <input type="radio" name="mapmark" value="起点" title="起点" {if $menu.mapmark=='起点'}checked=""{/if} >
            <input type="radio" name="mapmark" value="途经" title="途经" {if $menu.mapmark=='途经'}checked=""{/if}>
            <input type="radio" name="mapmark" value="终点" title="终点" {if $menu.mapmark=='终点'}checked=""{/if}>
          </div>
        </div>

        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="citys">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
          </div>
        </div>

      </form>

    </div>
    <div class="layui-tab-item {if empty($typeid)||$typeid=='3'}layui-show{/if}">
      <form class="layui-form" id="poi">

        {notempty name="$groupid"}
        <input type="hidden" name="groupid" value="{$groupid}">
        {/notempty}

        {notempty name="$menu.id"}
        <input type="hidden" name="id" value="{$menu.id}">
        {/notempty}

        <input type="hidden" name="typeid" value="3">

        <div class="layui-form-item poicity">
          <label class="layui-form-label">POI城市</label>
          <div class="layui-input-inline" id="poicity">
            <select name="cityname"  lay-filter="poicity" lay-verify="required" lay-search>
              {volist name="city" id="vo"}
              <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
              {/volist}
            </select>
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">POI类型</label>
          <div class="layui-input-inline" id="poitype">
            <input type="radio"  lay-filter="poitype" name="poitype" value="1" title="景点" {if $menu.poitype=='1'||$menu.poitype==""}checked=""{/if}>
            <input type="radio"  lay-filter="poitype" name="poitype" value="2" title="酒店" {if $menu.poitype=='2'}checked=""{/if}>
            <input type="radio"  lay-filter="poitype" name="poitype" value="3" title="其他" {if $menu.poitype=='3'}checked=""{/if}>
          </div>
        </div>

        <div class="layui-form-item pois" >
          <label class="layui-form-label">POI</label>
          <div class="layui-input-inline" style="width: 400px">
            <select name="poiname" id="citypoi"lay-filter="checkcitypoi"  lay-verify="required" lay-search>
              {volist name="citypoi" id="vo"}
              <option value="{$vo.name}" {if $menu.poiname==$vo.name} selected{/if}>{$vo.name}</option>
              {/volist}
            </select>
          </div>
          <span id="seepoi" data-id="{notempty name='$citypoi[0]["name"]'}{$citypoi[0]["name"]}{/notempty}" class="layui-btn layui-btn-danger layui-btn-sm" style="margin-top: 4px">详情</span>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">时间</label>
          <div class="layui-input-inline">
            <input name="time" value="{$menu.time}"  id="poitime"  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
          </div>
        </div>



        <div class="layui-form-item">
          <label class="layui-form-label">地图起始点</label>
          <div class="layui-input-inline">
            <input type="radio" name="mapmark" value="起点" title="起点" {if $menu.mapmark=='起点'}checked=""{/if} >
            <input type="radio" name="mapmark" value="途经" title="途经" {if $menu.mapmark=='途经'}checked=""{/if}>
            <input type="radio" name="mapmark" value="终点" title="终点" {if $menu.mapmark=='终点'}checked=""{/if}>
          </div>
        </div>


          <div class="layui-form-item">
              <label class="layui-form-label">展示信息</label>
              <div class="layui-input-inline">
                  <input type="checkbox" name="showmobile" title="联系方式" {if $menu.showmobile=='1'}checked=""{/if}>
                  <input type="checkbox" name="showticket" title="门票信息" {if $menu.showticket=='1'}checked=""{/if}>

                <input type="checkbox" name="showopen_time" title="开放时间" {if $menu.showopen_time=='1'}checked=""{/if}>
                <input type="checkbox" name="showticket_url" title="订票官网"  {if $menu.showticket_url=='1'}checked=""{/if}>
                <input type="checkbox" name="showeng_introduce" title="英文介绍" {if $menu.showeng_introduce=='1'}checked=""{/if}>
                <input type="checkbox" name="showdescription" title="特别说明" {if $menu.showdescription=='1'}checked=""{/if}>

                  <input type="checkbox" name="showprice" title="价格"  {if $menu.showprice=='1'}checked=""{/if}>
                  <input type="checkbox" name="showthumb" title="图片" {if $menu.showthumb!='0'}checked=""{/if}>
                <input type="checkbox" name="showsource" title="来源" {if $menu.showsource=='1'}checked=""{/if}>
                <input type="checkbox" name="showaddress" title="地址" {if $menu.showaddress!='0'}checked=""{/if}>
                  <input type="checkbox" name="showgrade" title="星级"{if $menu.showgrade=='1'}checked=""{/if}>

              </div>
          </div>


        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="poi">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
          </div>
        </div>

      </form>
    </div>
      <div class="layui-tab-item {if !empty($typeid)&&$typeid=='5'}layui-show{/if}">
          <form class="layui-form" id="team">
              {notempty name="$groupid"}
              <input type="hidden" name="groupid" value="{$groupid}">
              {/notempty}

            {notempty name="$menu.id"}
              <input type="hidden" name="id" value="{$menu.id}">
              {/notempty}

              <input type="hidden" name="typeid" value="5">

              <div class="layui-form-item">
                  <label class="layui-form-label">所属城市</label>
                  <div class="layui-input-inline">
                      <select name="cityname"  lay-filter="teamcity" lay-verify="required" lay-search>
                          {volist name="city" id="vo"}
                          <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
                          {/volist}
                      </select>
                  </div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label">跟团游名称</label>
                  <div class="layui-input-inline">
                      <select name="poiname" lay-verify="required" id="teampoi"  lay-search>
                          {volist name="teampoi" id="vo"}
                          <option value="{$vo.name}" {if $menu.poiname==$vo.name} selected{/if}>{$vo.name}</option>
                          {/volist}
                      </select>
                  </div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label">时间</label>
                  <div class="layui-input-inline">
                      <input name="time" value="{$menu.time}"  id="teamtime"  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                  </div>
              </div>



              <!--<div class="layui-form-item">-->
                  <!--<label class="layui-form-label">地图起始点</label>-->
                  <!--<div class="layui-input-inline">-->
                      <!--<input type="radio" name="mapmark" value="起点" title="起点" {if $menu.mapmark=='起点'}checked=""{/if} >-->
                      <!--<input type="radio" name="mapmark" value="途经" title="途经" {if $menu.mapmark=='途经'}checked=""{/if}>-->
                      <!--<input type="radio" name="mapmark" value="终点" title="终点" {if $menu.mapmark=='终点'}checked=""{/if}>-->
                  <!--</div>-->
              <!--</div>-->




              <div class="layui-form-item">
                  <div class="layui-input-block">
                      <button class="layui-btn" lay-submit lay-filter="team">立即提交</button>
                      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                  </div>
              </div>

          </form>

      </div>
    <div class="layui-tab-item {if !empty($typeid)&&$typeid=='4'}layui-show{/if}">
      <form class="layui-form" id="other">

        {notempty name="$groupid"}
        <input type="hidden" name="groupid" value="{$groupid}">
        {/notempty}

        {notempty name="$menu"}
        <input type="hidden" name="id" value="{$menu.id}">
        {/notempty}

        <input type="hidden" name="typeid" value="4">

        <div class="layui-form-item">
          <label class="layui-form-label">标题</label>
          <div class="layui-input-inline">
            <input name="title" value="{$menu.title}" lay-verify="required"   placeholder="请输入" autocomplete="off" class="layui-input" type="text">
          </div>
        </div>


        <div class="layui-form-item">
          <label class="layui-form-label">时间</label>
          <div class="layui-input-inline">
            <input name="time" value="{$menu.time}"  id="othertime"  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
          </div>
        </div>


        <div class="layui-form-item">
          <label class="layui-form-label">内容</label>
          <div class="layui-input-inline">
            <textarea placeholder="请输入内容" class="layui-textarea" name="content">{$menu.content}</textarea>
          </div>
        </div>



        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="other">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
          </div>
        </div>

      </form>
    </div>

  </div>
</div>

<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script>
  layui.use('layedit', function(){
    var layedit = layui.layedit;
    layedit.build('spotschaintroduce'); //建立编辑器
  });
</script>
<script>
  layui.use('laydate', function(){
    var laydate = layui.laydate;

    laydate.render({
      elem: '#airporttime'
      ,type: 'time'
      ,format: 'HH:mm'
    });

    laydate.render({
      elem: '#citystime'
      ,type: 'time'
      ,format: 'HH:mm'
    });
    laydate.render({
      elem: '#poitime'
      ,type: 'time'
      ,format: 'HH:mm'
    });

      laydate.render({
          elem: '#teamtime'
          ,type: 'time'
          ,format: 'HH:mm'
      });

    laydate.render({
      elem: '#othertime'
      ,type: 'time'
      ,format: 'HH:mm'
    });
  });
</script>

{if empty($typeid)}

<script>
  layui.use('element', function(){
    var $ = layui.jquery
            ,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

    //触发事件
    var active = {
      tabAdd: function(){
        //新增一个Tab项
        element.tabAdd('demo', {
          title: '新选项'+ (Math.random()*1000|0) //用于演示
          ,content: '内容'+ (Math.random()*1000|0)
          ,id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
        })
      }
      ,tabDelete: function(othis){
        //删除指定Tab项
        element.tabDelete('demo', '44'); //删除：“商品管理”


        othis.addClass('layui-btn-disabled');
      }
      ,tabChange: function(){
        //切换到指定Tab项
        element.tabChange('demo', '22'); //切换到：用户管理
      }
    };

    $('.site-demo-active').on('click', function(){
      var othis = $(this), type = othis.data('type');
      active[type] ? active[type].call(this, othis) : '';
    });

    //Hash地址的定位
    var layid = location.hash.replace(/^#test=/, '');
    element.tabChange('test', layid);

    element.on('tab(test)', function(elem){
      location.hash = 'test='+ $(this).attr('lay-id');
    });

  });
</script>

{/if}
<script>
  layui.use(['layer', 'form'], function() {
    var layer = layui.layer,
         $ = layui.jquery,
         form = layui.form;
    $(window).on('load', function() {
        form.on('submit(airport)', function(data) {
        $.ajax({
          url:"{:url('admin/trip/addactive')}",
          data:$('#airport').serialize(),
          type:'post',
          async: false,
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
              },1500)
            }
          }
        })
        return false;
      });


        $("#seepoi").on("click",function () {
            var name=$(this).attr("data-id");
            if(!name){
                layer.msg("没有POI信息");
                return false;
            }
            var activeurl="/admin/trip/activesee/name/"+name+".shtml";
            layer.open({
                type:2,
                content:activeurl,
                area: ['600px', '500px'],
                end:function(){
                    location.reload();
                }
            });
        })
        form.on('submit(citys)', function(data) {
            $.ajax({
                url:"{:url('admin/trip/addactive')}",
                data:$('#citys').serialize(),
                type:'post',
                async: false,
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        },1500)
                    }
                }
            })
            return false;
        });
        form.on('submit(poi)', function(data) {
            $.ajax({
                url:"{:url('admin/trip/addactive')}",
                data:$('#poi').serialize(),
                type:'post',
                async: false,
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        },1500)
                    }
                }
            })
            return false;
        });
        form.on('submit(team)', function(data) {
            $.ajax({
                url:"{:url('admin/trip/addactive')}",
                data:$('#team').serialize(),
                type:'post',
                async: false,
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        },1500)
                    }
                }
            })
            return false;
        });
        form.on('submit(other)', function(data) {
            $.ajax({
                url:"{:url('admin/trip/addactive')}",
                data:$('#other').serialize(),
                type:'post',
                async: false,
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        },1500)
                    }
                }
            })
            return false;
        });
        form.on('select(airportcity)', function(data){
                $.ajax({
                    url:"{:url('admin/trip/selectpoi')}",
                    data:{
                        name:data.value,
                        typeid:7
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code == 1) {
                            var data=res.data;
                            if(data.length>0){
                                var airportbox="";
                                for(var i = 0;i<data.length;i++){
                                    airportbox+='<option value="'+data[i].name+'">'+data[i].name+'</option>'
                                };
                                $("#airportpoi").html(airportbox);
                            }else{
                                $("#airportpoi").html("");
                            }
                            form.render('select');

                        }
                    }
                })
        });
        form.on('select(poicity)', function(data){
            var poitype="";
            $("#poitype input").each(function () {
                if($(this).prop('checked')){
                    poitype=$(this).val();
                }
            })
            $.ajax({
                url:"{:url('admin/trip/selectpoi')}",
                data:{
                    name:data.value,
                    poitype:poitype,
                    typeid:6
                },
                type:'post',
                async: false,
                success:function(res) {
                    if(res.code == 1) {
                        var data=res.data;
                        if(data.length>0){
                            var airportbox="";
                            for(var i = 0;i<data.length;i++){
                                airportbox+='<option value="'+data[i].name+'">'+data[i].name+'</option>'
                            };
                            $("#citypoi").html(airportbox);
                            $("#seepoi").attr('data-id',data[0]['name']);
                        }else{
                            $("#citypoi").html("");
                            $("#seepoi").attr('data-id',"");
                        }
                        form.render('select');
                    }
                }
            })
        });


        form.on('select(checkcitypoi)', function(data){
            $("#seepoi").attr('data-id',data.value);
        });

        form.on('radio(poitype)', function(data){
            var cityname=$("#poicity .layui-select-title input").eq(0).val();
            $.ajax({
                url:"{:url('admin/trip/selectpoi')}",
                data:{
                    name:cityname,
                    poitype:data.value,
                    typeid:6
                },
                type:'post',
                async: false,
                success:function(res) {
                    if(res.code == 1) {
                        var data=res.data;
                        if(data.length>0){
                            var airportbox="";
                            for(var i = 0;i<data.length;i++){
                                airportbox+='<option value="'+data[i].name+'">'+data[i].name+'</option>'
                            };
                            $("#citypoi").html(airportbox);
                            $("#seepoi").attr('data-id',data[0]['name']);
                        }else{
                            $("#citypoi").html("");
                            $("#seepoi").attr('data-id','');
                        }
                        form.render('select');
                    }
                }
            })
        });


        form.on('select(teamcity)', function(data){
            $.ajax({
                url:"{:url('admin/trip/selectpoi')}",
                data:{
                    name:data.value,
                    typeid:8
                },
                type:'post',
                async: false,
                success:function(res) {
                    if(res.code == 1) {
                        var data=res.data;
                        if(data.length>0){
                            var airportbox="";
                            for(var i = 0;i<data.length;i++){
                                airportbox+='<option value="'+data[i].name+'">'+data[i].name+'</option>'
                            };
                            $("#teampoi").html(airportbox);
                        }else{
                            $("#teampoi").html("");
                        }
                        form.render('select');
                    }
                }
            })
        });
    });
  });
</script>
</body>
</html>
